import request from '@/router/axios'

// 查询分组
export function queryCodeGroupList() {
    return request({
        url: '/cp/channelcodegroup/index',
        method: 'get',
    })
}
// 新建分组
export function addCodeGroup(data) {
    return request({
        url: '/cp/channelcodegroup',
        method: 'post',
        data
    })
}
// 修改分组
export function editCodeGroup(data) {
    return request({
        url: '/cp/channelcodegroup',
        method: 'put',
        data
    })
}
// 删除分组
export function delCodeGroup(data) {
    return request({
        url: '/cp/channelcodegroup',
        method: 'delete',
        params: data
    })
}

// 渠道活码列表查询
export function queryChannelCode(data) {
    return request({
        url: '/cp/channelcode/page',
        method: 'get',
        params: data
    })
}

// 渠道活码新建
export function addChannelCode(data) {
    return request({
        url: '/cp/channelcode',
        method: 'post',
        data
    })
}

// 渠道活码修改
export function editChannelCode(data) {
    return request({
        url: '/cp/channelcode',
        method: 'put',
        data
    })
}

// 渠道活码详情
export function queryChannelCodeDetail(id) {
    return request({
        url: '/cp/channelcode/' + id,
        method: 'get',
    })
}

// 渠道活码删除
export function delChannelCode(data) {
    return request({
        url: '/cp/channelcode',
        method: 'delete',
        params: data
    })
}

// 批量修改分组
export function changeCodeGroup(data) {
    return request({
        url: '/cp/channelcodegroup/moves',
        method: 'put',
        data
    })
}

// 批量下载
export function downloadBatchCode(data) {
    return request({
        url: '/cp/channelcode/exit-zip',
        method: 'post',
        data,
        responseType: 'blob'
    })
}

// 查询分组及活码
export function queryGroupAndCode(params) {
    return request({
        url: '/cp/channelcode/list',
        method: 'get',
        params,
    })
}